<template>
    <el-container>
        <el-header>
            <div class="right-panel">
                <div class="right-panel-search">
                    <el-input v-model="search.title_keywords" placeholder="请输入设备关键词" clearable @change="upsearch"></el-input>
                    <el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
                    <el-button type="primary" icon="el-icon-refresh" @click="refresh"></el-button>
                </div>
            </div>
        </el-header>
        <el-main class="nopadding">
            <scTable ref="table" :apiObj="apiObj" @selection-change="selectionChange" stripe remoteSort remoteFilter border>
                <el-table-column type="selection"  align="center" width="50"></el-table-column>
                <el-table-column label="设备部门" fixed prop="dept_name" align="center"></el-table-column>
                <el-table-column label="设备编码" fixed prop="code" align="center"></el-table-column>
                <el-table-column label="设备名称" fixed prop="title" align="center"></el-table-column>
                <el-table-column label="操作" align="center" width="100">
                    <template #default="scope">
                        <el-button-group>
                            <el-button text type="primary" size="small" @click="table_set(scope.row)" v-auth="'device.set'">设置</el-button>
                        </el-button-group>
                    </template>
                </el-table-column>
            </scTable>
        </el-main>
    </el-container>
    <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSuccess" @closed="dialog.save = false"></save-dialog>
</template>
<script>
import saveDialog from './save.vue';
export default {
    name: 'selectFilter',
    components: {
        saveDialog
    },
    data() {
        return {
            dialog:{
                show:false
            },
            apiObj:this.$API.jiankong.correspond.list,
            search: {
				keywords: null,
			},
        };
    },
    mounted() {
    },
    methods: {
        table_set(row){
            this.dialog.save = true
			this.$nextTick(() => {
				this.$refs.saveDialog.open('edit').setData(row)
			})
        },
        upsearch() {
			this.$refs.table.upData(this.search)
		},
        refresh(){
            for (const key in this.search) {
                this.search[key] = null;
            }
            this.$refs.table.upData(this.search)
        },
    },
};
</script>

<style scoped lang="scss">
</style>
